|
|
|
|
|
|
|
Figure 12.15
Translation followed by rotation. |
|
|
|
|
|
|
|
|
the right. Geometrically, this corresponds to a translation followed by a rotation rather than a rotation followed by a translation, as is shown in Figure 12.14. |
|
|
|
|
|
|
|
|
Scaling Without Translation |
|
|
|
|
|
|
|
|
The scaling transformation described earlier moves points further away from the origin. Figure 12.10, for example, shows an object scaled by a factor of two in the X direction. This operation moves each point twice as far from the Y axis as it was originally. |
|
|
|
|
|
|
|
|
The one point that is immune to this movement is the origin itself. Because the X and Y coordinates of the origin are both zero, they remain zero if you multiply them by any scale factors. You can use this fact to scale an object without moving it. |
|
|
|
|
|
|
|
|
Begin by translating the object so that it is located at the origin. Then scale the object and use the inverse of the original translation to move the object back to where it started. By composing the three transformation matrices, you can represent the combined operation with a single matrix. Figure 12.16 shows an object translated to the origin, scaled, and translated back to its original position in this way. |
|
|
|
|
|
|
|
|
Because the size of a scaled object has changed, you cannot put it back exactly where it was when you started. Only one of the object's points can return to its original position. In Figure 12.16, the object is placed centered over the position from which it came. The center point in the object was returned to its original position. Translating the center point to the origin made it easy to translate that point back to its original position after the scaling. |
|
|
|
|
|
|
|
|
To return the object so that a different point remains unmoved, translate that point to the origin. After you scale the object, that point is still at the origin, so it is easy to translate it back to its original location. Figure 12.17 shows an object similar to the one shown in Figure 12.16. In this case, the object is translated, scaled, and translated again so its lower-left corner is returned to its original position. |
|
|
|
|
|
|
|
|
Reflection across an Arbitrary Line |
|
|
|
|
|
|
|
|
Simple scaling transformation matrices scale an object with respect to the origin. Similarly, the reflections described earlier allow you to reflect an object only across the X or Y axis. By translating an object to the origin before scaling it, you can change the way |
|
|
|
|
|